package com.songlanyun.common.enums;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;
import com.songlanyun.common.drive.IntegerEnum;

import java.util.Objects;

/**
 * 积分
 */
public class IntegralConstant {


    /**
     * 获得积分类型
     * 0：'opus' 作品，
     * 1：‘article’ 文章，
     * 2：‘goods’ 商品，
     * 3:  ‘order’ 订单
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum IntegralModelType implements IntegerEnum<Integer> {

        OPUS(0, "作品"),

        ARTICLE(1, "文章"),

        GOODS(2, "商品"),

        ORDER(3, "订单"),

        RIGHTS_ORDER(4, "维权订单"),

        CONSUMPTION_VALUE_FREED_POINT(5,"贡献值释放积分"),

        POINT_GIVE_AWAY(6,"积分转赠"),

        POINT_TO_BALANCE(7,"积分兑换余额"),

        PLATFORM_GIVE_POINT(8,"平台赠送积分"),

        OFFLINE_CONSUMPTION_POINT(9,"上报订单消耗积分"),

        OFFLINE_ORDER_INCOME(10, "线上订单分润"),
        RECHARGE_INCOME(11, "代币转入"),
        WITHDRAW_OUT(12, "积分转出"),
        WITHDRAW_FAIL_INCOME(13, "积分转出失败返还"),
        BALANCE_TO_POINT(14, "余额转积分"),
        PLATFORM_ADJUST(15, "平台调整"),
        ADVERTISING_REWARDS(16, "广告奖励"),

//        WELFARE(5,"认证通过,配置的福利获得积分"),
//
//        WELFARE_DONATION(6,"公益捐款获得积分"),
//
//        OFFICIAL_DONATION(7,"官方捐赠获得积分"),
//
//        DONATION_POINTS(8,"公益积分捐赠"),
//
//        LOVE_VALUE_EXCHANGE(9,"爱心值兑换公益积分"),
//
//        SERVICE_POINTS_WITHDRAW_TO_WELFARE_INTEGRAL(10,"服务积分提现到公益积分"),

        ;


        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        IntegralModelType(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static IntegralModelType getByCode(int code) {
            for (IntegralModelType value : IntegralModelType.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }


    /**
     * 支出类型：
     * 0：EMPTY
     * 1：兑换积分商品消费支出
     * 2：公益积分捐赠
     * 3：公益积分捐赠
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum OuterMode implements IntegerEnum<Integer> {
        EMPTY(0, ""),
        CONSUME(1, "兑换积分商品消费支出"),
        DONATION_POINTS(2, "公益积分捐赠"),
        POINT_PLATFORM(3, "平台公益积分抵扣"),
        OUTER_POINT_GIVE_AWAY(4,"积分转赠减少"),
        POINT_TO_BALANCE(5,"积分兑换余额"),
        OFFLINE_CONSUMPTION_POINT(6,"上报订单消耗积分"),
        WITHDRAWAL_POINT(7,"积分转出"),
        PLATFORM_ADJUST(8,"平台调整"),
        ;


        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        OuterMode(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static OuterMode getByCode(int code) {
            for (OuterMode value : OuterMode.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }

    /**
     * 收入类型：
     * 1：被浏览
     * 2：被点赞
     * 3：被评论
     * 4：被分享
     * 5：浏览
     * 6：点赞
     * 7：评论
     * 8：分享
     * 9：购买商品
     * 10：积分商品支付过期退还
     * 11：取消订单退还
     * 12：兑换积分商品维权退还
     */
    @JsonFormat(shape = JsonFormat.Shape.OBJECT)
    public static enum InnerMode implements IntegerEnum<Integer> {
        EMPTY(0, ""),
        BY_BROWSE(1, "被浏览"),
        BY_LIKE(2, "被点赞"),
        BY_COMMENT(3, "被评论"),
        BY_SHARE(4, "被分享"),
        BROWSE(5, "浏览"),
        LIKE(6, "点赞"),
        COMMENT(7, "评论"),
        SHARE(8, "分享"),

        BUY_GOODS(9, "购买商品赠送"),
        PAY_EXPIRE(10, "积分商品支付过期退还"),
        CANCEL_ORDER(11, "取消订单退还"),
        POINT_ORDER_REFUND(12, "兑换积分商品维权退还"),
        CONSUMPTION_VALUE_FREED_POINT(13,"贡献值释放积分"),
        INNER_POINT_GIVE_AWAY(14,"积分转赠增加"),
        PLATFORM_GIVE_POINT(15,"积分转赠增加"),


        DIRECT_PUSH_USER(16,"消费者直推奖励"),
        CONSUMER_REGIMENT(17, "消费者团长奖励"),
        CONSUMER_INTERPOSITION_REGIMENT(18, "消费者间接团长奖励"),
        CONSUMER_TERRITORIAL(19,"消费者属地分润奖励"),
        SHOP_DIRECT_PUSH_USER(20,"商家直推奖励"),
        SHOP_CONSUMER_REGIMENT(21, "商家团长奖励"),
        SHOP_CONSUMER_INTERPOSITION_REGIMENT(22, "商家间接团长奖励"),
        SHOP_CONSUMER_TERRITORIAL(23,"商家直推奖励"),
        RECHARGE_INCOME(24,"积分转入"),
        WITHDRAW_FAIL_INCOME(25,"提现失败返还"),
        BALANCE_TO_POINT(26,"余额转积分"),

        PLATFORM_ADJUST(26,"平台调整"),
        ADVERTISING_REWARDS(28,"广告奖励"),
        ;
////

////        WELFARE(13,"认证通过,配置的福利获得积分"),
////        WELFARE_DONATION(14,"公益捐款获得积分"),
////        OFFICIAL_DONATION(15,"官方捐赠获得积分"),
////        LOVE_VALUE_EXCHANGE(16,"爱心值兑换公益积分"),
////        SERVICE_POINTS_WITHDRAW_TO_WELFARE_INTEGRAL(17,"服务积分提现到公益积分"),
        ;

        @EnumValue
        @JsonValue
        private Integer code;

        private String msg;

        InnerMode(Integer code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getMsg() {
            return msg;
        }

        public void setMsg(String msg) {
            this.msg = msg;
        }

        @Override
        public Integer getCode() {
            return code;
        }

        @JsonCreator
        public static InnerMode getByCode(int code) {
            for (InnerMode value : InnerMode.values()) {
                if (Objects.equals(code, value.getCode())) {
                    return value;
                }
            }
            return null;
        }
    }

}
